<tpl var layoutStyle={ />
<style type="text/css">
	.layui-table-cell .layui-form-checkbox[lay-skin="primary"] {
		padding-left: 28px;
	}
</style>
<tpl }; />
<tpl var layoutBody={ />
<div>
	<div class="layui-breadcrumb">
		<a href="./index.jspx">数据表</a>
		<a href="javascript:;"><cite>字段选择</cite></a>
	</div>
	<hr>
	<form class="layui-form layui-form-pane" action="">
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">Model数据库</label>
			<div class="layui-input-inline">
				<input type="text" name="modelTable" placeholder="请输入Model数据库" autocomplete="off" class="layui-input" value="${modelTable!}" readonly>
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">Model包路径</label>
			<div class="layui-input-inline">
				<input type="text" name="modelPackage" placeholder="请输入Model包路径" autocomplete="off" class="layui-input" value="${modelPackage!}">
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">控制器名称</label>
			<div class="layui-input-inline">
				<input type="text" name="controlName" placeholder="请输入控制器名称" autocomplete="off" class="layui-input" value="${controlName!}">
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">控制器路径</label>
			<div class="layui-input-inline">
				<input type="text" name="controlMapping" placeholder="请输入控制器路径" autocomplete="off" class="layui-input" value="${controlMapping!}">
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">模块名称</label>
			<div class="layui-input-inline">
				<input type="text" name="name" placeholder="请输入模块名称" autocomplete="off" class="layui-input" value="${name!}">
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<button class="layui-btn" lay-submit lay-filter="formDemo">立即生成</button>
		</div>
	</form>
	<table class="layui-table" lay-data="{height: 'full-220', page: false, loading:true, url:'columns.json?table=${modelTable!}'}">
		<thead>
			<tr>
				<th lay-data="{type:'numbers'}">ID</th>
				<th lay-data="{align:'center', toolbar: '#toolbar-tpl'}">作用域</th>
				<th lay-data="{field:'name'}">表名</th>
				<th lay-data="{field:'type'}">类型</th>
				<th lay-data="{field:'isnull'}">为空</th>
				<th lay-data="{field:'comment'}">备注</th>
			</tr>
		</thead>
	</table>
</div>
<tpl }; />

<tpl var layoutScript={ />
<script type="text/javascript">
	layui.config({
		base: '${webCdn}/plugins/layui/modules/'
	}).extend({
		http: 'http/http.min',
		message: 'message/message.min'
	}).use(['element', 'message', 'http', 'table', 'form'], function () {
		layui.form.on('submit(formDemo)', function (data) {
			layui.http.json('build.json', Object.assign({
				createList: $('.table-column input[name="createList"]:checked').map((i, item) => $(item).parent().data()).toArray(),
				updateList: $('.table-column input[name="updateList"]:checked').map((i, item) => $(item).parent().data()).toArray(),
				indexList: $('.table-column input[name="indexList"]:checked').map((i, item) => $(item).parent().data()).toArray(),
				viewList: $('.table-column input[name="viewList"]:checked').map((i, item) => $(item).parent().data()).toArray()
			}, data.field), (result) => layui.message.success(result.message || "提交成功"));

			return false;
		});
	});
</script>
<script type="text/html" id="toolbar-tpl">
	<div class="layui-btn-group table-column" data-name="{{d.name}}" data-type="{{d.type}}" data-isnull="{{d.isnull}}" data-comment="{{d.comment}}">
		<input type="checkbox" name="viewList" lay-skin="primary" title="查看" {{['id','create_time','update_time'].includes(d.name)?'':'checked'}}>
		<input type="checkbox" name="indexList" lay-skin="primary" title="列表" {{['id','create_time','update_time'].includes(d.name)?'':'checked'}}>
		<input type="checkbox" name="createList" lay-skin="primary" title="添加" {{['id','create_time','update_time'].includes(d.name)?'':'checked'}}>
		<input type="checkbox" name="updateList" lay-skin="primary" title="编辑" {{['id','create_time','update_time'].includes(d.name)?'':'checked'}}>
	</div>
</script>
<tpl }; />

<tpl include( "../../../tpl/layout.html" ,{identity: "platform:table" ,layoutStyle:layoutStyle,layoutBody:layoutBody,layoutScript:layoutScript}){} />